<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"/>
<%@ include file="/commons/jsp/taglibs.jsp"%>
<%@taglib prefix="frame" uri="http://www.framework.com/taglib"%>

<html>
  <head>
        <link href="${ctx}/commons/css/style.css" rel="stylesheet" type="text/css"/>
     	<link rel="stylesheet" type="text/css" href="${ctx}/commons/themes/default/easyui.css"></link>
     	<link rel="stylesheet" type="text/css" href="${ctx}/commons/themes/icon.css"></link>
     	<!-- jqueryUI JS文件的引入 -->
	    <script type="text/javascript" src="${ctx}/commons/js/jquery-1.8.0.min.js"></script>
	    <script type="text/javascript" src="${ctx}/commons/js/jquery.easyui.min.js"></script>
	    <script type="text/javascript" src="${ctx}/commons/js/easyui-extends-validate.js"></script>
	    <!-- jqueryUI国际化 -->
	    <script type="text/javascript" src="${ctx}/commons/js/easyui-lang-zh_CN.js"></script>
	    <!-- 开发使用的公用js方法 -->
	    <script type="text/javascript" src="${ctx}/commons/js/common.js"></script>
	    <!-- 开发国际化的引用，主要完成后台信息在前台提示的国际化，一定要放在最后 -->
	    <script type="text/javascript">var ctx = '${ctx}';var actionExt = "action";var i18n = new Object();</script>
	    <script src="${ctx}/commons/js/i18n/message_zh_CN.js" type="text/javascript"></script>
 </head>
	    <script type="text/javascript">
	    var DepositCategoryIds;
	    $(function(){
	       $('#t_projectInfo').datagrid({
	                     idField:'id',
	                     title:'项目暂停',
	                     url:'${ctx}/business/projectPause/bizmanager/projectList',
	                     fitColumns:true,//自动填充宽度
	                     striped:true,//隔行变色
	                     loadMsg:"数据正在加载中.....",
	                     rownumbers:true,//显示序号
	                     singleSelect:true,
	                     pagination:true,	
	                     nowrap:false,                    
	                     pageSize:20,
	                     pageList:[10,20,40,60],
	                     columns:[[   
	                     {field:'ck',checkbox:true }, 
	                     {field:'code',title:'编号',width:165,align:'center'},
				         {field:'name',title:'项目名称',width:150,align:'center'},
				         {field:'catagoryName',title:'项目类型',width:150,align:'center'},
				         {field:'auditable',title:'是否评标',width:150,align:'center',formatter: function(value,row,index){if(value==true){return '公共资源交易中心';}else{{return '采购人';}}}},
				         {field:'buyName',title:'采购人',width:150,align:'center'},
				         {field:'manageName',title:'项目负责人',width:150,align:'center'},	
				         {field:'createTime',title:'创建时间',width:200,align:'center'},	
				         {field:'bidStartTime',title:'开标时间',width:200,align:'center'},
				         {field:'statusName',title:'状态',width:150,align:'center'},
				         {field:'operate',title:'操作', align:'center',width:300,formatter:formatOper}		
				         
               ]]    

	       });
	       
	       
	    });
		function formatOper(val, row, index) {
	       if(row.status==7 && row.pauseCategeroy== "0" && row.pauseResult == "0"){
				return '<a href="#" onclick="projectPause(\'' + row.id+ '\',0)">暂停审核</a>&nbsp<a href="javascript:void(0)" onclick="getProjectDetail(\'' + row.id + '\')" class="">详情</a>';	
			}else if(row.status==10 && row.pauseCategeroy==1 && row.pauseResult ==0){
				return '<a href="#" onclick="projectPause(\'' + row.id+ '\',1)">暂停审核</a>&nbsp<a href="javascript:void(0)" onclick="getProjectDetail(\'' + row.id + '\')" class="">详情</a>';	
			}else{
				return '<a href="javascript:void(0)" onclick="getProjectDetail(\'' + row.id + '\')" class="">详情</a>';	
			}
			
		

		} 	
		//管理员审核
		 function projectPause(id,category){   
			    $('#projectPause').dialog({
				 			title:"审核",  
						    iconCls:'icon-view',
						    width: '600',    
						    height:'260',    
						    closed: false,    
						    inline : true,
						    cache: false,    
					        href: "${ctx}/business/projectPause/bizmanager/toPauserAuditPage?projectId="+id,
						    modal: true,
							extractor : function(data){
								if($.trim(data) == "unLogin"){
									var msn = ''||i18n[''];
									msn = msn||i18n[data];
									if(msn != undefined){
										top.$.messager.alert('提示',msn,'info',function(){top.location=orderParamObj.ctx+'/manage';});
										return '';
									}
								}
								return data;
							   },
							   buttons : [
							        {text:'提交',
									iconCls:'icon-ok',
									handler:function(){	
										$('#myform').form('submit', {    
										    url:'${ctx}/business/projectPause/bizmanager/AuditProjectPause?pauseCategory='+category,
										    onSubmit: function(){ 											    										
										    if (!$('#myform').form('validate')) {
										    	$.messager.alert('提示信息','验证没有通过,不能提交表单！','info');
												return false; //当表单验证不通过的时候 必须要return false 
											   }
										    if($("#replay").val()=="" && $('input:radio:checked').val()==2){
										    	$.messager.alert('提示信息','批复不为空！','info');
										    	return false; 
										    }
										    },   
										    success:function(data){
										       if(data=="saveSuccess"){	
										    $.messager.alert('提示信息','保存成功！','info',function(){
												$('#t_projectInfo').datagrid('reload');
											});   
												}  
												else {
											 $.messager.alert('提示信息','提交失败！','info');   
												
													 }
													 
										      $('#projectPause').dialog('close');
										     
										    }    
		                              });  
										}
									
									}
								,
								{
									text:'取消',
									iconCls:'icon-cancel',
									handler:function(){
										$('#projectPause').dialog('close');
								}}
								
								],
			    
							});
				 		$('#projectPause').dialog("center");
			       
			    
			 }	
		 
		
		 
    	/**
		*项目详情
		*/
		function getProjectDetail(id){
			top.$('#firstLevelDialog').dialog({    
			    title:"项目详情",  
			    iconCls:'icon-view',
			    width: 1000,    
			    height: 580,    
			    closed: false,    
			    inline : true,
			    cache: false,    
			    href: "${ctx}/business/projectmanage/getProjectDetail?projectId=" + id+"&roleId=bizmanager",
			    modal: true,
				extractor : function(data){
					if($.trim(data) == "unLogin"){
						var msn = ''||i18n[''];
						msn = msn||i18n[data];
						if(msn != undefined){
							top.$.messager.alert('提示',msn,'info',function(){top.location='ctx/manage';});
							return '';
						}
					}
					return data;
				},
			    buttons : [{
						text:'取消',
						iconCls:'icon-cancel',
						handler:function(){
							top.$('#firstLevelDialog').dialog('close');
						}}]
			});
			top.$('#firstLevelDialog').dialog("center");
		}
    	
    	  //查询
	       function searchProject(){
	    	  $('#t_projectInfo').datagrid('load', {    
	    		    code:$("#code").val(), 
	    		    name: $("#name").val(),
	    		    tenderType:$("#tenderType").combobox('getValue')
	    		}); 

	       }
	       //查询
	       function resetSearch(){
	    	   $("#code").val("");
	    	   $("#name").val("");
	    	   $("#tenderType").combobox('setValue',"");
	       }
        </script>
   

 
  
  <body>
     <div class="easyui-layout" style="width:100%;height:100%;">
		     <div data-options="region:'north',border:false" style="padding: 4px;height: 50px;overflow: hidden;"id="banner">
		    	<div class="easyui-panel" data-options="fit:true,border:true" >
					<div class="queryContent" >			
						<table class="queryTable" >
							<tbody>
								<tr>
									<th width="50%">编号</th>
									<td width="10%">
									<input class="easyui-validatebox" type="text" name="code" id="code" maxlength="20" style="width:120px;;height: 15px;"></input></td>
									<th >项目类型</th>
									<td width="10%">
										<select  class="easyui-combobox" name="tenderType" id="tenderType"  style="width:120px;;height: 25px;" data-options="valueField:'name',textField:'name',url:'${ctx}/business/projectPause/bizmanager/getProjectType'" >
										</select>  
										
									</td>
									<th>项目名称</th>
									<td><input class="easyui-validatebox" type="text" name="name" maxlength="20" id="name" style="width:120px;"></input></td>
									<td align="right" width="10%"><a href="javascript:void(0);" class="easyui-linkbutton" id="searchUser" onclick="searchProject();" iconcls="icon-search"   plain="true">查询</a>
									<a href="javascript:void(0);" class="easyui-linkbutton" id="resetSearch" onclick="resetSearch();" iconcls="icon-reset" plain="true">清空</a></td>
								</tr>
							</tbody>
						</table>				
					</div>
				</div>
			</div>
	     <div data-options="region:'center'" >
			    <table id="t_projectInfo" data-options="toolbar:'#toolbar',fit:true"></table>
	     </div>
     </div>
     <div id="projectPause"></div>
  </body>
</html>
